public class Emitter extends IEmitter
IEmitter.
Initialize an Emitter using Particles.createCopy(particleengine.Emitter, com.fs.starfarer.api.graphics.SpriteAPI, int, int, int). After setting the emitter's properties,
generate particles using Particles.burst(particleengine.IEmitter, int) or Particles.stream(particleengine.IEmitter, int, float, float).| Modifier and Type | Method and Description |
|---|---|
void |
acceleration(float minX,
float maxX,
float minY,
float maxY)
Sets the acceleration of generated particles along the emitter's axes.
|
void |
acceleration(org.lwjgl.util.vector.Vector2f min,
org.lwjgl.util.vector.Vector2f max)
Sets the component-wise minimum and maximum accelerations of generated particles along the emitter's axes.
|
void |
alphaShift(float minA,
float maxA) |
void |
circleAcceleration(float innerRadius,
float outerRadius)
Adds circular randomness to the accelerations of particles generated by this
Emitter. |
void |
circleOffset(float innerRadius,
float outerRadius)
Adds circular randomness to the positions of particles generated by this
Emitter. |
void |
circleVelocity(float innerRadius,
float outerRadius)
Adds circular randomness to the velocities of particles generated by this
Emitter. |
void |
color(java.awt.Color color) |
void |
color(float[] rgba) |
void |
color(float r,
float g,
float b,
float a)
Sets the initial color of particles generated by this
Emitter. |
void |
colorHSVA(float[] hsva)
Sets the initial color of particles generated by this
Emitter. |
void |
colorShiftHSVA(float[] hsva) |
void |
colorShiftHSVA(float[] minHSVA,
float[] maxHSVA) |
void |
colorShiftHSVA(float h,
float s,
float v,
float a)
Adds color shift to particles, allowing individual particles to change color over time.
|
void |
colorShiftHSVA(float minH,
float maxH,
float minS,
float maxS,
float minV,
float maxV,
float minA,
float maxA)
Adds color shift to particles, allowing individual particles to change color over time.
|
void |
colorValueShift(float minV,
float maxV) |
void |
facing(float minAngle,
float maxAngle)
Sets minimum and maximum initial facing angles of particles generated by this
Emitter. |
void |
fadeTime(float minFadeIn,
float maxFadeIn,
float minFadeOut,
float maxFadeOut)
Sets the fade-in and fade-out times for particles generated by this
Emitter. |
void |
fromJSON(org.json.JSONObject json)
Loads properties from a JSON object.
|
int |
getBlendDestinationFactor() |
int |
getBlendFunc() |
int |
getBlendSourceFactor() |
com.fs.starfarer.api.combat.CombatEngineLayers |
getLayer() |
org.lwjgl.util.vector.Vector2f |
getLocation() |
float |
getRenderRadius() |
com.fs.starfarer.api.graphics.SpriteAPI |
getSprite() |
float |
getXDir() |
void |
growthAcceleration(float minAcceleration,
float maxAcceleration)
Sets the growth acceleration of particles generated by this
Emitter. |
void |
growthAcceleration(float minXAcceleration,
float maxXAcceleration,
float minYAcceleration,
float maxYAcceleration)
Same as
growthAcceleration(float, float), but allows specification of x-scale and y-scale separately. |
void |
growthRate(float minRate,
float maxRate)
Sets the initial growth rate of particles generated by this
Emitter. |
void |
growthRate(float minXRate,
float maxXRate,
float minYRate,
float maxYRate)
Same as
growthRate(float, float), but allows specification of x-scale and y-scale separately. |
void |
hueShift(float minH,
float maxH) |
void |
life(float minLife,
float maxLife)
Sets the minimum and maximum lifetime of particles generated by this
Emitter. |
void |
offset(float minX,
float maxX,
float minY,
float maxY)
Sets the position of generated particles relative to this emitter's location.
|
void |
offset(org.lwjgl.util.vector.Vector2f min,
org.lwjgl.util.vector.Vector2f max)
Sets the component-wise minimum and maximum positions of generated particles relative to this emitter's location,
along the emitter's axes.
|
void |
radialAcceleration(float minAcceleration,
float maxAcceleration)
Adds acceleration in the direction from the emitter's
location to each individual particle's randomized position. |
void |
radialVelocity(float minVelocity,
float maxVelocity)
Adds velocity in the direction from the emitter's
location to each individual particle's randomized position. |
void |
randomHSVA(float[] hsva) |
void |
randomHSVA(float h,
float s,
float v,
float a)
Randomizes the initial color of particles generated by this
Emitter. |
void |
revolutionAcceleration(float minAcceleration,
float maxAcceleration) |
void |
revolutionRate(float minRate,
float maxRate)
Causes particles to revolve around the emitter's
location at the time of generation. |
void |
saturationShift(float minS,
float maxS) |
void |
setAxis(float dir) |
void |
setAxis(org.lwjgl.util.vector.Vector2f xAxis)
Sets the axes of this emitter's coordinate system.
|
void |
setBlendMode(int sfactor,
int dfactor,
int blendMode)
Sets the blend source factor, destination factor, and blending function.
|
void |
setInactiveBorder(float amount)
Sets the "render radius" of the emitter.
|
void |
setLayer(com.fs.starfarer.api.combat.CombatEngineLayers layer)
Sets the rendering layer of this emitter.
|
void |
setLocation(float x,
float y)
Sets this emitter's location.
|
void |
setLocation(org.lwjgl.util.vector.Vector2f location) |
void |
setSprite(com.fs.starfarer.api.graphics.SpriteAPI sprite)
Sets the sprite used by this emitter.
|
void |
setSprite(java.lang.String loc)
Sets the sprite used by this emitter.
|
void |
setSyncSize(boolean sync)
Sets whether generated particles should always have the same
x and y scale. |
void |
sinusoidalMotionX(float minAmplitude,
float maxAmplitude,
float minFrequency,
float maxFrequency,
float minPhase,
float maxPhase)
Adds periodic motion along the emitter's x-axis.
|
void |
sinusoidalMotionY(float minAmplitude,
float maxAmplitude,
float minFrequency,
float maxFrequency,
float minPhase,
float maxPhase) |
void |
size(float minSize,
float maxSize)
Sets the size of particles generated by this
Emitter. |
void |
size(float minXSize,
float maxXSize,
float minYSize,
float maxYSize)
Same as
size(float, float), but allows specification of x-scale and y-scale separately. |
void |
turnAcceleration(float minAcceleration,
float maxAcceleration)
Sets minimum and maximum turn rate accelerations for particles generated by this
Emitter. |
void |
turnRate(float minRate,
float maxRate)
Sets minimum and maximum initial turn rates for particles generated by this
Emitter. |
void |
velocity(float minX,
float maxX,
float minY,
float maxY)
Sets the velocity of generated particles along the emitter's axes.
|
void |
velocity(org.lwjgl.util.vector.Vector2f min,
org.lwjgl.util.vector.Vector2f max)
Sets the component-wise minimum and maximum velocities of generated particles along the emitter's axes.
|
void |
writeJSON(java.lang.String name)
Writes this emitter's properties to a file with the given name.
|
disableDynamicAnchoring, enableDynamicAnchoringpublic void setInactiveBorder(float amount)
[-amount,W+amount]x[-amount,H+amount]
relative to the viewport when particles would have been generated, that generate call is ignored.amount - Border amount, in world units.public void setLayer(com.fs.starfarer.api.combat.CombatEngineLayers layer)
CombatEngineLayers for an
ordered list of possible values.layer - Combat layer to render particles topublic void setLocation(float x,
float y)
offset(float, float, float, float).x - Initial x-position, in absolute world units.y - Initial y-position, in absolute world units.public void setLocation(org.lwjgl.util.vector.Vector2f location)
setLocation(float, float)public void setAxis(org.lwjgl.util.vector.Vector2f xAxis)
(0, 1) and (1, 0).xAxis - The emitter's x-axis. Doesn't need to be normalized. If degenerate, will be set to the default
value (0, 1). The emitter's y-axis will automatically be set to the
unit vector that is counterclockwise perpendicular to xAxis.public void setAxis(float dir)
setAxis(Vector2f)public void setSprite(com.fs.starfarer.api.graphics.SpriteAPI sprite)
sprite - Sprite to use. Can be null.public void setSprite(java.lang.String loc)
loc - Location of sprite to use. If null, will set the sprite to null.public void setBlendMode(int sfactor,
int dfactor,
int blendMode)
sfactor - Source factor, e.g. GL11.GL_SRC_ALPHA.dfactor - Destination factor, e.g. GL11.GL_ONE_MINUS_SRC_ALPHA.blendMode - Blending operator, e.g. GL14.GL_FUNC_ADD.public void life(float minLife,
float maxLife)
Emitter.
Particles exceeding their lifespan are not rendered.minLife - Minimum lifetime, in seconds.maxLife - Maximum lifetime, in seconds.public void fadeTime(float minFadeIn,
float maxFadeIn,
float minFadeOut,
float maxFadeOut)
Emitter. Particles' alpha values rise linearly from
0 to 1 within the fade-in window, and fall linearly from 1 to 0 within
the fade-out window.minFadeIn - Minimum fade-in time, in seconds.maxFadeIn - Maximum fade-in time, in seconds.minFadeOut - Minimum fade-out time, in seconds.maxFadeOut - Maximum fade-out time, in seconds.public void offset(float minX,
float maxX,
float minY,
float maxY)
minX - Minimum offset of particles along the emitter's x-axis in world units.maxX - Maximum offset of particles along the emitter's x-axis in world units.minY - Minimum offset of particles along the emitter's y-axis in world units.maxY - Maximum offset of particles along the emitter's y-axis in world units.public void offset(org.lwjgl.util.vector.Vector2f min,
org.lwjgl.util.vector.Vector2f max)
min - Minimum x and y offsets.max - Maximum x and y offsets.public void velocity(float minX,
float maxX,
float minY,
float maxY)
minX - Minimum velocity of particles along the emitter's x-axis in world units / s.maxX - Maximum velocity of particles along the emitter's x-axis in world units / s.minY - Minimum velocity of particles along the emitter's y-axis in world units / s.maxY - Maximum velocity of particles along the emitter's y-axis in world units / s.public void velocity(org.lwjgl.util.vector.Vector2f min,
org.lwjgl.util.vector.Vector2f max)
min - Minimum x and y velocities.max - Maximum x and y velocities.public void acceleration(float minX,
float maxX,
float minY,
float maxY)
minX - Minimum acceleration of particles along the emitter's x-axis in world units / s^2.maxX - Maximum acceleration of particles along the emitter's x-axis in world units / s^2.minY - Minimum acceleration of particles along the emitter's y-axis in world units / s^2.maxY - Maximum acceleration of particles along the emitter's y-axis in world units / s^2.public void acceleration(org.lwjgl.util.vector.Vector2f min,
org.lwjgl.util.vector.Vector2f max)
min - Minimum x and y accelerations.max - Maximum x and y accelerations.public void circleOffset(float innerRadius,
float outerRadius)
Emitter. Generated particles will have a random
vector inside an annulus with inner radius innerRadius and outer radius outerRadius added to their positions.innerRadius - Inner radius of annulus inside which a random vector will be chosen to be added to each
particle's starting position.outerRadius - Outer radius of annulus inside which a random vector will be chosen to be added to each
particle's starting position.public void circleVelocity(float innerRadius,
float outerRadius)
Emitter. Generated particles will have a random
vector inside an annulus with inner radius innerRadius and outer radius outerRadius added to their velocities.innerRadius - Inner radius of annulus inside which a random vector will be chosen to be added to each
particle's initial velocity.outerRadius - Outer radius of annulus inside which a random vector will be chosen to be added to each
particle's initial velocity.public void circleAcceleration(float innerRadius,
float outerRadius)
Emitter. Generated particles will have a random
vector inside an annulus with inner radius innerRadius and outer radius outerRadius added to their accelerations.innerRadius - Inner radius of annulus inside which a random vector will be chosen to be added to each
particle's initial acceleration.outerRadius - Outer radius of annulus inside which a random vector will be chosen to be added to each
particle's initial acceleration.public void facing(float minAngle,
float maxAngle)
Emitter.
Each particle will have an initial facing randomly chosen between the two given angles. A
facing direction of 0 is oriented along this emitter's x-axis.minAngle - Minimum initial facing direction, in degrees.maxAngle - Maximum initial facing direction, in degrees.public void turnRate(float minRate,
float maxRate)
Emitter. Each particle will
have an initial turn rate randomly chosen between the two given numbers.minRate - Minimum initial turn rate, in degrees / s.maxRate - Maximum initial turn rate, in degrees / s.public void turnAcceleration(float minAcceleration,
float maxAcceleration)
Emitter. Each particle will have
a turn rate acceleration randomly chosen between the two given numbers.minAcceleration - Minimum initial turn rate acceleration, in degrees / s^2.maxAcceleration - Maximum initial turn rate acceleration, in degrees / s^2.public void size(float minSize,
float maxSize)
Emitter. Each particle is given a size randomly chosen between
minSize and maxSize.minSize - Minimum initial particle size, in world units.maxSize - Maximum initial particle size, in world units.public void growthRate(float minRate,
float maxRate)
Emitter. Each particle is given
a growth rate randomly chosen between minRate and maxRate.minRate - Minimum initial particle growth rate, in world units / s.maxRate - Maximum initial particle growth rate, in world units / s.public void growthAcceleration(float minAcceleration,
float maxAcceleration)
Emitter. Each particle is
given a growth acceleration randomly chosen between minAcceleration and maxAcceleration.minAcceleration - Minimum particle growth acceleration, in world units / s^2.maxAcceleration - Maximum particle growth acceleration, in world units / s^2.public void size(float minXSize,
float maxXSize,
float minYSize,
float maxYSize)
size(float, float), but allows specification of x-scale and y-scale separately.public void growthRate(float minXRate,
float maxXRate,
float minYRate,
float maxYRate)
growthRate(float, float), but allows specification of x-scale and y-scale separately.public void growthAcceleration(float minXAcceleration,
float maxXAcceleration,
float minYAcceleration,
float maxYAcceleration)
growthAcceleration(float, float), but allows specification of x-scale and y-scale separately.public void setSyncSize(boolean sync)
x and y scale. If this is set,
then only the emitter's x values will be taken into account for size, growth rate, and growth acceleration.sync - If true, ensures that generated particles have the same x and y sizes,
growth rates, and growth accelerations. If false, these properties will have their x
and y values set independently.public void color(float r,
float g,
float b,
float a)
Emitter.r - Initial red value, between 0 and 1.g - Initial green value, between 0 and 1.b - Initial blue value, between 0 and 1.a - Initial alpha value, between 0 and 1.public void color(java.awt.Color color)
color(float, float, float, float)public void color(float[] rgba)
color(float, float, float, float)public void colorHSVA(float[] hsva)
Emitter. emitter in HSVA space.hsva - 4-element float array containing hue, saturation, color value, and alpha.public void randomHSVA(float h,
float s,
float v,
float a)
Emitter. Each particle has its initial hue modified
by a number in the range [-h/2, h/2]. The particle's other hsva channels are similarly randomized.
Resulting hue values outside [0, 360)
wrap around. Resulting saturation, value, and alpha values are clamped to [0, 1].h - Hue randomization, in degrees. Hue is between 0 and 360.s - Saturation randomization. Saturation is between 0 and 1.v - Value randomization. Value is between 0 and 1.a - Alpha randomization. Alpha is between 0 and 1.public void randomHSVA(float[] hsva)
public void colorShiftHSVA(float h,
float s,
float v,
float a)
[0, 360), it will wrap around. Resulting saturation, value, and alpha values
are clamped to [0, 1].h - Hue shift per second, in degreess - Saturation shift per secondv - Value shift per seconda - Alpha shift per secondpublic void colorShiftHSVA(float[] hsva)
public void colorShiftHSVA(float minH,
float maxH,
float minS,
float maxS,
float minV,
float maxV,
float minA,
float maxA)
minH and maxH,
a random saturation velocity between minS and maxS,
a random value velocity between minV and maxV,
and a random alpha velocity between minA and maxA.
If the resulting hue value falls outside [0, 360), it will wrap around. Resulting saturation, value, and alpha values
are clamped to [0, 1].minH - Minimum hue shift per second, in degreesmaxH - Maximum hue shift per second, in degreesminS - Minimum saturation shift per secondmaxS - Maximum saturation shift per secondminV - Minimum value shift per secondmaxV - Maximum value shift per secondminA - Minimum alpha shift per secondmaxA - Maximum alpha shift per secondpublic void colorShiftHSVA(float[] minHSVA,
float[] maxHSVA)
public void hueShift(float minH,
float maxH)
public void saturationShift(float minS,
float maxS)
public void colorValueShift(float minV,
float maxV)
public void alphaShift(float minA,
float maxA)
public void radialVelocity(float minVelocity,
float maxVelocity)
location to each individual particle's randomized position.
This effect causes particles to be pushed outwards from the emitter's location.
No effect on emitters with no offset or positionSpread.minVelocity - Minimum outward radial velocity, in world units / s.maxVelocity - Maximum outward radial velocity, in world units / s.public void radialAcceleration(float minAcceleration,
float maxAcceleration)
location to each individual particle's randomized position.minAcceleration - Minimum outward radial acceleration, in world units / s^2.maxAcceleration - Maximum outward radial acceleration, in world units / s^2.radialVelocity(float, float)public void revolutionRate(float minRate,
float maxRate)
location at the time of generation. Note that
updates to the emitter's location after a particle has already been generated are not received.
This effect is applied after all other movement effects.minRate - Minimum initial revolution velocity, in degrees / s.maxRate - Maximum initial revolution velocity, in degrees / s.public void revolutionAcceleration(float minAcceleration,
float maxAcceleration)
minAcceleration - Minimum revolution acceleration, in degrees / s^2.maxAcceleration - Maximum revolution acceleration, in degrees / s^2.revolutionRate(float, float)public void sinusoidalMotionX(float minAmplitude,
float maxAmplitude,
float minFrequency,
float maxFrequency,
float minPhase,
float maxPhase)
t = 0.minAmplitude - Minimum amplitude of periodic motion along the emitter's x-axis, in world units.maxAmplitude - Maximum amplitude of periodic motion along the emitter's x-axis, in world units.minFrequency - Minimum number of complete cycles per second along the emitter's x-axis.maxFrequency - Maximum of complete cycles per second along the emitter's x-axis.minPhase - Minimum initial phase of periodic motion along the emitter's x-axis, in degrees.maxPhase - Maximum initial phase of periodic motion along the emitter's x-axis, in degrees.public void sinusoidalMotionY(float minAmplitude,
float maxAmplitude,
float minFrequency,
float maxFrequency,
float minPhase,
float maxPhase)
minAmplitude - Minimum amplitude of periodic motion along the emitter's y-axis, in world units.maxAmplitude - Maximum amplitude of periodic motion along the emitter's y-axis, in world units.minFrequency - Minimum number of complete cycles per second along the emitter's y-axis.maxFrequency - Maximum of complete cycles per second along the emitter's y-axis.minPhase - Minimum initial phase of periodic motion along the emitter's y-axis, in degrees.maxPhase - Maximum initial phase of periodic motion along the emitter's y-axis, in degrees.sinusoidalMotionX(float, float, float, float, float, float)public org.lwjgl.util.vector.Vector2f getLocation()
getLocation in class IEmitterpublic com.fs.starfarer.api.graphics.SpriteAPI getSprite()
public float getXDir()
public int getBlendSourceFactor()
getBlendSourceFactor in class IEmitterGL11.GL_SRC_ALPHA.public int getBlendDestinationFactor()
getBlendDestinationFactor in class IEmitterGL11.GL_ONE_MINUS_SRC_ALPHA.public int getBlendFunc()
getBlendFunc in class IEmitterGL14.GL_FUNC_ADD.public com.fs.starfarer.api.combat.CombatEngineLayers getLayer()
public float getRenderRadius()
getRenderRadius in class IEmitterpublic void fromJSON(org.json.JSONObject json)
throws org.json.JSONException
json - JSON object to load from.org.json.JSONException - if the provided json is malformed.public void writeJSON(java.lang.String name)
particleengine.json.name - File name to use